/**
 * 包含所有action creator
 * 同步的action 都返回的是一个对象
 * 异步的action 返回的是一个函数
 */
import {
    INCREMENT,
    DECREMENT
} from '../redux/action-types'

export const increment = (number) => ({
    type: INCREMENT,
    data: number
})
export const decrement = (number) => ({
    type: DECREMENT,
    data: number
})
export const incrementAsync = (number) => {
    return dispatch => {
        // 1s 之后才去分发一个增加的action
        setTimeout(() => {
            dispatch(increment(number))
        }, 1000)
    }
}